/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package movie.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author admin
 */
@Entity
@Table(name = "box_office")
@NamedQueries({
	@NamedQuery(name = "BoxOffice.findAll", query = "SELECT b FROM BoxOffice b")})
public class BoxOffice implements Serializable {
	private static final long serialVersionUID = 1L;
	@Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_box_office")
	private Integer idBoxOffice;
	@Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "time_starting")
	private String timeStarting;
	@Basic(optional = false)
    @NotNull
    @Column(name = "date_begin")
    @Temporal(TemporalType.DATE)
	private Date dateBegin;
	@Basic(optional = false)
    @NotNull
    @Column(name = "date_end")
    @Temporal(TemporalType.DATE)
	private Date dateEnd;
	@JoinColumn(name = "film_id", referencedColumnName = "id_film")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
	private Film filmId;

	public BoxOffice() {
	}

	public BoxOffice(Integer idBoxOffice) {
		this.idBoxOffice = idBoxOffice;
	}

	public BoxOffice(Integer idBoxOffice, String timeStarting, Date dateBegin, Date dateEnd) {
		this.idBoxOffice = idBoxOffice;
		this.timeStarting = timeStarting;
		this.dateBegin = dateBegin;
		this.dateEnd = dateEnd;
	}

	public Integer getIdBoxOffice() {
		return idBoxOffice;
	}

	public void setIdBoxOffice(Integer idBoxOffice) {
		this.idBoxOffice = idBoxOffice;
	}

	public String getTimeStarting() {
		return timeStarting;
	}

	public void setTimeStarting(String timeStarting) {
		this.timeStarting = timeStarting;
	}

	public Date getDateBegin() {
		return dateBegin;
	}

	public void setDateBegin(Date dateBegin) {
		this.dateBegin = dateBegin;
	}

	public Date getDateEnd() {
		return dateEnd;
	}

	public void setDateEnd(Date dateEnd) {
		this.dateEnd = dateEnd;
	}

	public Film getFilmId() {
		return filmId;
	}

	public void setFilmId(Film filmId) {
		this.filmId = filmId;
	}

	@Override
	public int hashCode() {
		int hash = 0;
		hash += (idBoxOffice != null ? idBoxOffice.hashCode() : 0);
		return hash;
	}

	@Override
	public boolean equals(Object object) {
		// TODO: Warning - this method won't work in the case the id fields are not set
		if (!(object instanceof BoxOffice)) {
			return false;
		}
		BoxOffice other = (BoxOffice) object;
		if ((this.idBoxOffice == null && other.idBoxOffice != null) || (this.idBoxOffice != null && !this.idBoxOffice.equals(other.idBoxOffice))) {
			return false;
		}
		return true;
	}

	@Override
	public String toString() {
		return "movie.entity.BoxOffice[ idBoxOffice=" + idBoxOffice + " ]";
	}
	
}
